const log4js = require('log4js');
const logFile = '/data/logs/skynet-flight.jsengine/app/jsengine.log';

log4js.configure({
    appenders: {
        out: {
            type: 'stdout',
            layout: {
                type: 'pattern',
                pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} %p %m'
            }
        },
        file: {
            type: 'dateFile',
            filename: logFile,
            encoding: 'utf-8',
            layout: {
                type: 'pattern',
                pattern: '%d{yyyy-MM-dd hh:mm:ss.SSS} %p %m',
            },
            pattern: "yyyy-MM-dd",
            keepFileExt: true,
        }
    },
    categories: {
        default: {appenders: ['out', 'file'], level: 'info'}
    }
});

let logger = log4js.getLogger();
module.exports = logger
